<!DOCTYPE html>
<html>
<head>
<title>滚轮效果jQuery版 - Liehuo.Net</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<script type="text/javascript" src="./jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="./jquery.mousewheel.js"></script>
</head>
<body>
<input type="text" id="txt1" value="0" class="txt"/>
<input type="text" id="txt2" value="10" class="txt"/>
<input type="text" id="txt3" value="-10" class="txt"/>
<input type="text" id="txt4" value="10.4" class="txt"/>
<script>
$(function(){
    $(".txt").mousewheel(function(objEvent, intDelta){
        ScrollText(this,intDelta);//intDelta代表鼠标滚动，向上时，intDelta大于0。
    });
})
function ScrollText(oTxt,arg){
    oTxt.focus();
    var _value=parseInt(oTxt.value);
    if(isNaN(_value)){
        _value = 0;
    }
    if(arg>0){
        _value++;
    }else{
        _value--;
    }
    oTxt.value=_value;
    oTxt.select();//选取效果
}
</script>
</body>
</html>